use std::collections::HashSet;

struct Solution {}

impl Solution {
    pub fn title_to_number(column_title: String) -> i32 {
        const TWENTY_SIX: i32 = 26;
        let mut rev = column_title.chars().rev().collect::<String>();
        let mut ret = 0;
        for idx in 0..rev.len() {
            let a1 = rev.chars().nth(idx).unwrap() as i32 - 'A' as i32 + 1;
            // print!("{}, {}\n", a1, idx);
            ret += a1 * (TWENTY_SIX.pow(idx as u32));
        }
        ret
    }
}